home *** CD-ROM | disk | FTP | other *** search
- Path: access1.digex.net!not-for-mail
- From: ell@access1.digex.net (Ell)
- Newsgroups: comp.lang.c++
- Subject: Re: polymorphism and style
- Date: 27 Feb 1996 04:37:36 GMT
- Organization: The Universe
- Message-ID: <4gu1qg$bmc@news4.digex.net>
- References: <4gr4ur$n13@alpha.pcix.com>
- NNTP-Posting-Host: access1.digex.net
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- ed lizewski (elizewsk@capecod.net) wrote:
- : Question on polymorphism and style.
- : Want to call a function in a most derived class off a pointer to the base
- : class. The fuction does not exist in the base class.
- : I should:
- : 1)downcast ?
- : 2)add the function to the base class and add virtual stubs to every
- : class that does not use it ?
- : 3)add it to the base class but define it like
- : foo( ..whatever..) {error_msg("virtual function not defined");}
- : This way only the class that uses it would have to define it.
- : 4) ?
- :
- : thanks for your time.
-
- C++ Run-Time Type Information (RTTI) _may_ help you here. And it may or
- may not be suitable in a proper OO design way.
-
- Elliott
-
-
-